package controle.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

import Entidades.RankngGrupo;
import Entidades.RankngResumo;
import banco.maneger.RankngManeger;

public class RankingListaAction implements ActionCommand  {

	@Override
	public void executeAction(HttpServletRequest request, HttpServletResponse response) {
		RankngManeger maneger = new RankngManeger();
		List<RankngResumo> list = maneger.getLista();
		maneger.closeConnection();
		String json = new Gson().toJson(list);
		response.setContentType("application/json");
		response.setCharacterEncoding("UTF-8");
		try {
			response.getWriter().write(json);
			System.out.println(json);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
